Skip to content

feat(git): remind to commit once work has stayed uncommitted - #112

Open
SylvainDruaux wants to merge 1 commit into
flowtricks:mainfrom
SylvainDruaux:feat/commit-reminder
Open

SylvainDruaux wants to merge 1 commit into
flowtricks:mainfrom
SylvainDruaux:feat/commit-reminder

Conversation

@SylvainDruaux

Copy link
Copy Markdown
Contributor

Once a project has held uncommitted changes for a chosen interval, Stacki says so quietly:

  • one line above the commit message in the Git panel: "Uncommitted changes for 1 hour"
  • a dot on the title bar's branch chip, whose tooltip says the same
  • a dot on the rail's Git tab while the Git panel is closed

The time shown moves on by itself. The reminder stays until a commit, or until it is turned off.

A clock beside "Commit to " picks the interval: Off, 30 minutes, 1, 2 or 4 hours (1 hour by default). The choice is kept per project on this computer, beside the commit type, never in the project.

Only uncommitted time counts: a project with nothing to commit is never reminded of anything. When the work became uncommitted, and on which commit, is kept on this computer too. A project reopened on the same commit picks up where it left off; on any other commit (made elsewhere, amended, another branch) the clock starts at opening.

Why

Many people who come to Stacki are new to Git, often coming from Webflow, where the site saves itself and backups happen without anyone thinking about them. In Stacki, nothing is kept as a step until it is committed: hours of work can stay uncommitted, with no point to come back to if something goes wrong, nothing to compare against, and nothing that can be shared or published. People used to Git commit out of habit; people new to it simply don't think of it.

This reminder is there to build that habit, gently.

Why a reminder, and not automatic backups like Webflow's

Webflow's automatic backups were the obvious model, and were left out on purpose:

  • A safety net that saves work on its own teaches people new to Git that committing is optional, the opposite of the habit they need.
  • It would add a second history beside Git's, with its own storage, restore flow and edge cases, and people would have to understand both.
  • A commit is the step people come back to, share and publish. Teaching that one step is worth more than hiding it.

Why it stays subtle

No toast, no dialog, nothing that interrupts the work. A reminder that nags gets turned off, and one that is turned off teaches nothing. A dot and one line are enough to be noticed when you look, and easy to leave for later when you are in the middle of something.

Studio

The line and the clock appear in Studio's Git panel. There is no rail dot, and the clock runs only while the Git panel is open, because Studio reads Git status only there.

Notes for review

  • No new source files, to stay under Studio's 2,950-file release target: the reminder lives in useGitSession.ts and GitChipView.tsx.
  • The Apps rail badge's class becomes the shared .rail-badge, used by both dots.
  • forgetProjectPreference is added to src/lib/projectPreference.ts.

Tests

  • test/renderer/git/commitReminder.test.js: the clock, the stored values and their bounds, and the hook in jsdom under a mocked clock, reopening included.
  • test/renderer/git/commitReminderChromium.test.js: the real Git panel in all 18 languages at 260, 340 and 600px. It checks that the line never goes past the panel, takes at most two lines, and that the clock stays centred at the end of the heading.
  • Full gate: 1590/1590 suites passed.

Once a project has held uncommitted changes for a chosen interval, Stacki says so quietly: one line above the commit message in the Git panel ("Uncommitted changes for 1 hour"), a dot on the title bar's branch chip, whose tooltip says the same, and a dot on the rail's Git tab while the Git panel is closed. The time shown moves on by itself, and the reminder stays until a commit or until it is turned off; nothing snoozes it.

A clock beside "Commit to <branch>" picks the interval: Off, 30 minutes, 1, 2 or 4 hours, with 1 hour by default. Its tooltip names the interval, and it dims while the reminder is off. The choice is kept per project on this computer, beside the commit type and with the same bound, never in the project.

Only uncommitted time counts: a project with nothing to commit is never reminded of anything, however long it stays open. When the uncommitted work began, and on which commit, is kept on this computer too, so a project reopened on the same commit picks up where it left off, and a reminder already due shows at once. On any other commit (one made elsewhere, an amend, another branch) the changes are newer, and the clock starts at opening.

Why a reminder and not automatic backups like Webflow's: a safety net that saves work on its own teaches people new to Git that committing is optional, and it would add a second history beside Git's, with its own storage, restore flow and edge cases. A commit is the step people come back to, share and publish, so the reminder teaches that habit instead.

Why it stays subtle: no toast, no dialog, nothing that interrupts the work. A reminder that nags gets turned off, and one that is turned off teaches nothing. A dot and one line are enough to be noticed when you look, and easy to leave for later when you are in the middle of something.

Studio shows the line and the clock in its Git panel. It has no rail dot, and its clock runs only while the Git panel is open, because Studio reads Git status only there.

No new source files: Studio's release targets 2,950 files, so the reminder lives in useGitSession.ts and GitChipView.tsx. The Apps rail badge's class becomes the shared .rail-badge, used by both dots.

commitReminder.test.js covers the clock, the kept values and their bounds, and the hook in jsdom under a mocked clock, reopening included. commitReminderChromium.test.js draws the real Git panel in all 18 languages at 260, 340 and 600px, and checks that the line never reaches past the panel, takes at most two lines, and that the clock stays centred at the end of the heading.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant